package collection

func GroupBy(array []T, iteratee func(value T) V) map[V][]T {
	ret := map[V][]T{}
	for _, value := range array {
		v := iteratee(value)
		ret[v] = append(ret[v], value)
	}
	return ret
}
